import sys


class Platform:
    """
    获取当前平台的名称.
    """
    WINDOWS = 'windows'
    LINUX = 'linux'
    MACOS = 'macos'
    UNKNOWN = 'unknown'

    @staticmethod
    def get_platform():
        if sys.platform.startswith('win'):
            return Platform.WINDOWS
        elif sys.platform.startswith('linux'):
            return Platform.LINUX
        elif sys.platform.startswith('darwin'):
            return Platform.MACOS
        else:
            return Platform.UNKNOWN

    @staticmethod
    def is_win11():
        return sys.platform == 'win32' and sys.getwindowsversion().build >= 22000

    @staticmethod
    def is_win10():
        return sys.platform == 'win32' and sys.getwindowsversion().build >= 17763

    @staticmethod
    def is_win8():
        return sys.platform == 'win32' and sys.getwindowsversion().build >= 9200

    @staticmethod
    def is_win7():
        return sys.platform == 'win32' and sys.getwindowsversion().build >= 7601

    @staticmethod
    def is_macos():
        return sys.platform.startswith('darwin')

    @staticmethod
    def is_linux():
        return sys.platform.startswith('linux')

    @staticmethod
    def is_windows():
        return sys.platform.startswith('win')
